/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.wx.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.wx.entity.WxUser;
import com.jeesite.modules.wx.dao.WxUserDao;

/**
 * 用户表Service
 * @author wangjianxin
 * @version 2018-09-27
 */
@Service
@Transactional(readOnly=true)
public class WxUserService extends CrudService<WxUserDao, WxUser> {
	
	/**
	 * 获取单条数据
	 * @param wxUser
	 * @return
	 */
	@Override
	public WxUser get(WxUser wxUser) {
		return super.get(wxUser);
	}
	
	/**
	 * 查询分页数据
	 * @param page 分页对象
	 * @param wxUser
	 * @return
	 */
	@Override
	public Page<WxUser> findPage(Page<WxUser> page, WxUser wxUser) {
		return super.findPage(page, wxUser);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param wxUser
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(WxUser wxUser) {
		super.save(wxUser);
	}
	
	/**
	 * 更新状态
	 * @param wxUser
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(WxUser wxUser) {
		super.updateStatus(wxUser);
	}
	
	/**
	 * 删除数据
	 * @param wxUser
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(WxUser wxUser) {
		super.delete(wxUser);
	}

	public WxUser findByOpenId(String openId){
		return dao.findByOpenId(openId);
	}

	/**
	 * tree查询所有用户
	 * @param wxUser
	 * @return
	 */
	public List<WxUser> treeData(WxUser wxUser){
		return dao.treeData(wxUser);
	}
	/**
	 * 查询购买过活动的用户
	 * @param activityId
	 * @return
	 */
	public List<WxUser> treeDataForBuyActivity(String activityId){
		return dao.treeDataForBuyActivity(activityId);
	}

}